require(['Jquery','Hui','HuiAdmin','Layer','Icheck'], function(jquery,hui,huiadmin,layer,iCheck){

	// 单选框样式
	radioCss = function(){
		$('.ara-radio').iCheck({
			radioClass: 'iradio-blue',
			increaseArea: '20%'
		});
	}

	/**
	 * AJAX方式表单提交
	 */
	ajaxSubmitFrom = function(){
		$('.submit').click(function () {
			var form  = $('#ajaxSubmitForm');
			url       = form.attr('action');
			formData  = form.serialize();
			name = form.find(".auth-name").val();
			title = form.find(".auth-title").val();

			if (!name) {
			  	layer.alert("规则名称不能为空",{icon: 2});
			  	return;
			}

			if (!title) {
			  	layer.alert("规则描述不能为空",{icon: 2});
			  	return;
			}

		    $.post(url,formData,function(json) {
	      		if (json.code) {
	      			layer.alert(json.msg,{icon: 1});
	      			pageReload(1500);
	      		} else {
	      			layer.alert(json.msg,{icon: 5});
	      		}
		    },"json");
		});
	}

	// AJAX方式表单提交
	ajaxSubmitFrom();

	// 单选框样式
	radioCss();

});